package com.wing.feign.res;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.wing.common.exception.BusinessException;
import com.wing.common.utils.JsonResult;
import com.wing.enterprise.feign.EnterpriseClient;
import com.wing.enterprise.res.ReceiptRecord;
import com.wing.enterprise.res.ReceiptRecordDetail;
import com.wing.util.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhutao
 * @version 1.0
 * @since 2025-06-27 10:54
 */
@Service
public class ReceiptRecordFeign implements ReceiptRecordIFeign{

    @Autowired
    private EnterpriseClient enterpriseClient;
    
    @Override
    public ReceiptRecord saveReceiptRecord(ReceiptRecord receiptRecord) {
        JsonResult<ReceiptRecord> jsonResult = enterpriseClient.saveReceiptRecord(receiptRecord);
        return (ReceiptRecord) HttpUtil.JsonResultDataHandle(jsonResult);
    }
    
    @Override
    public void saveReceiptRecordDetail(List<ReceiptRecordDetail> receiptRecordDetails) {
        JsonResult jsonResult = enterpriseClient.saveReceiptRecordDetail(receiptRecordDetails);
        HttpUtil.JsonResultHandle(jsonResult);
    }
}
